package edu.spec.sms.model.mental;

import edu.spec.sms.model.Student;
import edu.spec.sys.model.enumeration.FinishStatus;

import javax.persistence.*;
import java.util.Date;

/**
 *
 * 学生与心理测评关联
 */
@Entity
@Table(name = "t_student_mental")
public class StudentMental {

    // 主键
    private int id;
    // 学生对应的POJO
    private Student student;
    // 心理测试对应的POJO
    private Mental mental;
    private String mentalName;
    private String mentalDescription;
    private Date closeDate;
    private Date finishDate;

    // 测试得分
    private int score;
    // 完成状态
    private FinishStatus finishStatus;

    public StudentMental() {
    }

    public StudentMental(Student student, Mental mental, Date closeDate) {
        this.student = student;
        this.mental = mental;
        this.closeDate = closeDate;
        this.mentalName = mental.getName();
        this.mentalDescription = mental.getDescription();
    }

    @Id
    @GeneratedValue
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @ManyToOne
    @JoinColumn(name = "student_id")
    public Student getStudent() {
        return student;
    }

    public void setStudent(Student student) {
        this.student = student;
    }

    @ManyToOne
    @JoinColumn(name = "mental_id")
    public Mental getMental() {
        return mental;
    }

    public void setMental(Mental mental) {
        this.mental = mental;
    }

    @Column(name = "mental_name")
    public String getMentalName() {
        return mentalName;
    }

    public void setMentalName(String mentalName) {
        this.mentalName = mentalName;
    }

    @Column(name = "mental_description")
    public String getMentalDescription() {
        return mentalDescription;
    }

    public void setMentalDescription(String mentalDescription) {
        this.mentalDescription = mentalDescription;
    }

    @Column(name = "close_date")
    public Date getCloseDate() {
        return closeDate;
    }

    public void setCloseDate(Date closeDate) {
        this.closeDate = closeDate;
    }

    @Column(name = "finish_date")
    public Date getFinishDate() {
        return finishDate;
    }

    public void setFinishDate(Date finishDate) {
        this.finishDate = finishDate;
    }

    public int getScore() {
        return score;
    }

    public void setScore(int score) {
        this.score = score;
    }

    @Column(name = "finish_status")
    public FinishStatus getFinishStatus() {
        return finishStatus;
    }

    public void setFinishStatus(FinishStatus finishStatus) {
        this.finishStatus = finishStatus;
    }
}
